﻿using Ding.Helpers;
using Ding.Log;
using Ding.TimedJob.Schema;
using GitDC.SignalR;
using Microsoft.AspNetCore.SignalR;
using System.Threading.Tasks;

namespace GitDC.Jobs
{
    public class TimedJob : Job
    {
        [Invoke(Interval = 1000 * 60, SkipWhileExecuting = true, IsEnabled = true)]
        public async Task TimedTest()
        {
            XTrace.UseConsole();

            //var DCSetBumenService = Ioc.Create<ISysCodeService>();
            //XTrace.WriteLine(DCSetBumenService.GetAll().Count.ToString());

            //XTrace.WriteLine("测试开始");

            //await SendHubs.Send("Send");

            var A = ChatsHub.HubManager;
            if (A == null)
            {
                A = Ioc.Create<HubLifetimeManager<ChatsHub>>();
            }
            await A.SendAllAsync("ReceiveMessage", new[] { "首页测试2", "返回信息" });

            //XTrace.WriteLine("测试结束");


            await Task.FromResult(0);
        }

    }
}
